package com.sws.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sws.domain.Document;
import com.sws.mapping.DocumentMapper;
import com.sws.model.ActivityModel;
import com.sws.service.ActivityService;

@Controller
public class TestController {
	
	private Logger logger = LoggerFactory.getLogger(TestController.class);
	
	@Autowired
	DocumentMapper mapper;

	@ResponseBody
	@RequestMapping("/test1")
	public String sayHello(HttpServletRequest request) {
		String dirPath = request.getServletContext().getRealPath("/Upload/SecondLedger");
		logger.info("say hello {}" + dirPath);
		return "hello";
	}
	
	@ResponseBody
	@RequestMapping("/test")
	public String test() {
		logger.info("test");
		Document record = new Document();
		record.setPath("这是一个路径");
		
		return "document id is " + mapper.insertSelective(record);
	}
}
